#!/usr/bin/env bash

###
# 
# 集群清理脚本
###
if [ $# != 1 ] ; then 
    echo "USAGE: $0 MASTER_NAME" 
    echo " e.g.: $0 k8s-m1" 
    kubectl get nodes
    exit 1; 
fi 

if [[ $1 == `hostname` ]];then
    kubectl drain $1 --delete-local-data --force --ignore-daemonsets
    kubectl delete node $1
    kubeadm reset -f 
else
    echo '没有权限'
fi

